package com.bjpowernode.springboot.web;


import com.bjpowernode.springboot.domain.CharacterVO;
import com.bjpowernode.springboot.domain.UserVO;
import com.bjpowernode.springboot.service.CharacterVOService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/characterVO")
public class CharacterVOController {
    @Autowired
    CharacterVOService characterVOService;
    @ApiOperation(value = "根据name查询")
    @GetMapping("/get")
    public UserVO charVOByName(@RequestParam String characterName){
        return characterVOService.charVOByName(characterName);
    }

    @ApiOperation(value = "根据ID查询")
    @GetMapping("/getByID")
    public CharacterVO charByID(@RequestParam Integer id){
        return characterVOService.charByID(id);
    }

    @ApiOperation(value = "根据ID或名字查询")
    @GetMapping("/getByIDOrName")
    public CharacterVO charByIdOrName(@RequestParam(required = false) Integer id, @RequestParam(required = false) String characterName){
        return characterVOService.charByIdOrName(id, characterName);
    }

}
